package com.example.day12;

/**
 * @author Lenovo
 */
public class Jumpping {
    interface jumpping {
        void jump();
    }

    class JumppingOpeeator {
        public void useJumpping(Jumping j) {
            j.jump();
        }

        public Jumping getJumpping() {
            Jumping j = new Cat();
            return j;
        }
    }

    class Cat extends Jumping {
        public void jump() {
            System.out.println("猫跳");
        }
    }

    public class JumppingDemo {
        public void main(String[] args) {
            JumppingOpeeator jo = new JumppingOpeeator();
            Jumping j = new Cat();
            jo.useJumpping(j);
            Jumping j2 = jo.getJumpping();
            j2.jump();
        }
    }
}
